import exceptions

def is_true(assertion, message=""):
	are_equal (True, assertion, message)
	
def is_false(assertion, message=""):
	are_equal (False, assertion, message)
		
def are_equal(expected, actual, message=""):
	if expected != actual:
		if len(message) == 0:
			fail('Expected [%s] but was [%s].' % (expected, actual))
		else:
			fail('Expected [%s] but was [%s]. %s' % (expected, actual, message))

def are_not_equal(not_expected, actual, message=""):
	if not_expected == actual:
		if len(message) == 0:
			fail('Expected not [%s] but was [%s].' % (not_expected, actual))
		else:
			fail('Expected not [%s] but was [%s]. %s' % (not_expected, actual, message))
			
def is_none(actual, message=""):
	are_equal(None, actual, message)
	
def is_not_none(actual, message=""):
	are_not_equal(None, actual, message)

def fail(message=""):
	raise AssertionException(message)
	
def ignore(message=""):
	raise IgnoreException(message)
	
class IgnoreException(exceptions.Exception):
	def __init__(self, message):
		self.message = message
		return
			
	def __str__( self ):
		return self.__class__.__name__ + ": " + self.message
	
class AssertionException(exceptions.Exception):
	def __init__(self, message):
		self.message = message
		return
			
	def __str__( self ):
		return self.__class__.__name__ + ": " + self.message
